<template>
    <!-- 分页   v-if='paginations.total > 0'    -->
    <el-row>
        <el-col :span="24">
            <div class="pagination">
                <el-pagination
                        :page-sizes="paginations.page_sizes"
                        :page-size="paginations.page_size"
                        :layout="paginations.layout"
                        :total="paginations.total"
                        :current-page.sync='paginations.page_index'
                        @current-change='handleCurrentChange'
                        @size-change='handleSizeChange'>
                </el-pagination>
            </div>
        </el-col>
    </el-row>
</template>

<script>
    export default {
        name: "Pagination",
        methods: {
            handleSizeChange(val) {
                console.log(`每页 ${val} 条`);
                this.$emit("updatePageSize",val);
            },
            handleCurrentChange(val) {
                console.log(`当前页: ${val}`);
                this.$emit("updatePageNo",val);    //父的update
            }
        },
        props: {
            paginations: Object,
        },
        data() {
            return {};
        }
    }

</script>

<style scoped>
    .pagination {
        text-align: right;
        margin-top: 10px;
    }
</style>
